package com.hzbank.generate.service;

import com.hzbank.generate.entity.BsOrgaBaseInfo;
import com.hzbank.generate.entity.PmChnlInfo;
import com.hzbank.generate.entity.PmCurrencyInfo;
import com.hzbank.generate.mapper.EntityMapper;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;

@Service
public class EntityServiceImpl implements EntityService{
    @Autowired
    private EntityMapper entityMapper;
    @Override
    public BsOrgaBaseInfo selectOneBsOrgaBase() {
        return null;
    }

    @Override
    public PmChnlInfo selectOnePmChnlInfo() {
        return entityMapper.selectOnePmchnlInfo();
    }

    @Override
    public PmCurrencyInfo selectOneCurrency() {
        return null;
    }

    @Override
    public String selectOneMemo() {
        return null;
    }

    @Override
    @Transactional
    public int insertPmChnlInfo() {
        PmChnlInfo chnlInfo1 = new PmChnlInfo();
        chnlInfo1.setChnlCode("aa");
        chnlInfo1.setChnlName("aaaa");

        int i1 = entityMapper.insertPmChnlInfo(chnlInfo1);
        PmChnlInfo chnlInfo2 = new PmChnlInfo();
        chnlInfo2.setChnlCode("bb");
        chnlInfo2.setChnlName("bbbb");
        int i2 = entityMapper.insertPmChnlInfo(chnlInfo2);
        Integer.parseInt("hello");//自定义异常

        PmChnlInfo chnlInfo3 = new PmChnlInfo();
        chnlInfo3.setChnlCode("cc");
        chnlInfo3.setChnlName("cccc");
        int i3 = entityMapper.insertPmChnlInfo(chnlInfo3);
        int num = i1 + i2 + i3;
        return num;
    }
}
